Simplify doc meta mode - #159473
Conversation
|
r? @folkertdev rustbot has assigned @folkertdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
r? @camelid |
|
|
Since we're getting rid of the ability to do finalize and document at the same time, we can't actually do this in the rustdoc-html test build system and need to do it this way instead.
Co-authored-by: Noah Lev <37223377+camelid@users.noreply.github.com>
Co-authored-by: Noah Lev <37223377+camelid@users.noreply.github.com>
9e2125b to
d0fec14
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
| let krate = ast::Crate { | ||
| attrs: Default::default(), | ||
| items: Default::default(), | ||
| spans: Default::default(), | ||
| id: ast::DUMMY_NODE_ID, | ||
| is_placeholder: false, | ||
| }; |
There was a problem hiding this comment.
I don't love that we're creating a dummy crate here just to get a TyCtxt. It seems like we only use the TyCtxt to get the Sess. So I don't think you actually need to do this. interface::Compiler already has a Sess on it.
There was a problem hiding this comment.
I've removed the synthetic crate, but not the synthetic InputStr.
| let config = core::create_config( | ||
| Input::Str { | ||
| name: rustc_span::FileName::Custom(String::new()), | ||
| input: String::new(), | ||
| }, | ||
| options, | ||
| &render_options, | ||
| ); | ||
| return wrap_return( | ||
| dcx, | ||
| rustc_span::create_session_globals_then(options.edition, &[], None, || { | ||
| run_merge_finalize(render_options) | ||
| interface::run_compiler(config, |compiler| { | ||
| run_merge_finalize(render_options, compiler) |
There was a problem hiding this comment.
Ditto here, but getting rid of the fake Input::Str is harder, and this seems less bad than making a fake crate and TyCtxt. So fine to just leave it.
| .arg(format!("--read-doc-meta-dir={}", parts_out_dir.display())) | ||
| .arg("--enable-index-page") | ||
| .run(); | ||
| output.assert_stderr_not_contains("error: the compiler unexpectedly panicked. this is a bug."); |
There was a problem hiding this comment.
nit: Is this necessary? Shouldn't the run-make test fail automatically if one of its subprocesses ICEs? (I'm not super familiar with run-make, so I might be wrong about this.)
There was a problem hiding this comment.
I just checked, and you're right.
rust/src/tools/run-make-support/src/command.rs
Lines 232 to 240 in d3ea035
Apparently, when a run-make command exits with a non-zero exit code, this thing will fail the test.
rust/src/tools/run-make-support/src/util.rs
Lines 31 to 43 in d3ea035
|
|
||
| fn main() { | ||
| let merged_dir = path("merged"); | ||
| let parts_out_dir = path("parts"); |
There was a problem hiding this comment.
It's not. I've removed it.
| .library_search_path(cwd()) | ||
| .out_dir(&out_dir) | ||
| .arg("-Zunstable-options") | ||
| .arg("--write-doc-meta-dir=parts-wrong") |
There was a problem hiding this comment.
I don't understand why this is parts-wrong -- if they all use the same name, there's nothing wrong about it. I think this might have been lost in translation from the original test.
There was a problem hiding this comment.
There's no --read-doc-meta-dir, and the sierra.rs tests all verify that the shared resources aren't generated.
I've added a comment, and renamed the dir parts-unused, to clarify this.
|
Reminder, once the PR becomes ready for a review, use |
This comment has been minimized.
This comment has been minimized.
c3d3011 to
f73cd1e
Compare
| If this parameter is supplied but `--read-doc-meta-dir` isn't, it runs in *intermediate mode*: | ||
| some pages may be written to the output dir, but there is a lot of functionality that won't work | ||
| until rustdoc is run in *finalize mode*. | ||
| When `--write-doc-meta-dir` is supplied, rustdoc will write the crate's shared metadata to |
There was a problem hiding this comment.
Probably not the right question for this PR, and I haven't read the implementation here, though I am curious:
- How does this interact with
--out-dir. I guess--out-diris ignored here? - How does this interact with all those
--emitfiles (w/ or w/o--out-dir? Where will those files be emitted?
There was a problem hiding this comment.
Context: I'd like to pass --emit=dep-info without specifying the full (absolute) path for those dep-info files. Because of this issue #159743 we cannot specify full path, and currently blocks rust-lang/cargo#17020.
(That said, it is a very Cargo specific issue I feel like)
There was a problem hiding this comment.
The --out-dir is still used as the path for --emit files. --write-doc-meta-dir doesn't pay attention to --out-dir.
There was a problem hiding this comment.
I see. So eventually if individual rustdoc doesn't need to emit html contents, cargo then can use --emit to control dep-info emission location exclusively. Thanks!
View all comments
Follow up #159415 (comment)
Get rid of the mode where you can finalize the CCI and generate more docs at the same time. It isn't used in Cargo, and probably won't be used elsewhere?